#ifndef _ListE_h_
#define _ListE_h_
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include "Node.h"
#include <stdio.h>
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

  class TListE {
      
    private :
        
      typedef void (*TFunctionAction)(TNode*, void* reference);
      typedef bool (*TFunctionConditional)(TNode*, void*  reference);
      typedef int  (*TFunctionConditionalS)(TNode*, void*  reference);

      void   MixList(TFunctionConditional, void*, TListE*);
      void   MixListX(TFunctionConditional, void*, TListE*, TListE*, TListE*);
      
      TNode* PosNode(int);
      
    protected:

      int   length;
      TNode *first;
      
    public :

      TListE();
      TListE(void*);
      TListE(TListE *);

      ~TListE();

      void   Add(void*);
      void   AddIni(void*);
      void   AddNode(TNode*);
      void   AddNodeIni(TNode*);
      void   Delete(int);
      void   Delete(void*);
      void   Insert(void*, int);
      void   InsertNode(TNode*, int);
      void*  Transfer(int);
      TNode* TransferNode(int);
      void   Destroy(int);
      bool   Update(void*, int);
      
      int    Length(){return this->length;}
      void*  Get(int);

      void   ForEach(TFunctionAction, void*);
      void*  FirstOcurrence(TFunctionConditional, void*);
      void   AllOcurrence(TFunctionConditional, TListE&, void*);
      void   AllOcurrenceCond(TFunctionConditionalS, TListE&, void*);
      int    NumberOcurrence(TFunctionConditional, void*);
      void   OrderList(TFunctionConditional, void*);
      void   MergeList(TFunctionConditional, void*);
      
      bool   Empty() { return !length; };
      
      TListE operator=(const TListE &ListT) { this->length = ListT.length; this->first = ListT.first; return *this;};
      
  };

//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
  
#endif 